<%@ page import="com.party.core.model.system.TargetType" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>资料编辑</title>
    <%@include file="../../include/commonFile.jsp" %>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/ui/activity/publish_act.css">
    <style type="text/css">
        .cover-content .cover-img {
            width: 80px !important;
            height: 80px !important;
        }

        .layui-tab-brief > .layui-tab-title .layui-this {
            color: #e8473f !important;
        }

        .layui-tab-brief > .layui-tab-title .layui-this:after {
            border-bottom-color: #e8473f !important;
        }

        #mchForm .layui-form-item .layui-input-inline {
            width: 280px !important;
        }

        .forget-pwd-btn {
            color: #e8473f;
            margin-left: 20px;
        }

        .forget-pwd-btn:hover {
            color: #3b97d7;
        }
    </style>
</head>
<body>
<!--头部-->
<%@include file="../../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <%--<div class="c-time-list-header">
                <div class="r">
                    <a href="${ctx}/system/member/memberIndex.do" class="layui-btn layui-btn-radius layui-btn-danger"> <i class="iconfont icon-back btn-icon"></i>返回</a>
                </div>
                <div class="ovh">
                    <span class="title f20">账户中心&nbsp;&gt;&nbsp;资料编辑</span>
                </div>
            </div>--%>

            <input type="hidden" id="mobile" value="${member.mobile}"/>

            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <%--<li><span class="title f20 ml5 mr5">服务升级</span></li>--%>
                    <li class="layui-this"><span class="title f20 ml5 mr5">资料编辑</span></li>
                    <c:if test="${partnerType == 4}">
                        <li><span class="title f20 ml5 mr5">提现账号</span></li>
                    </c:if>
                    <li><span class="title f20 ml5 mr5">修改密码</span></li>
                    <!-- 					<li><span class="title f20 ml5 mr5">绑定商户信息</span></li> -->
                    <li><span class="title f20 ml5 mr5">修改退款密码</span></li>
                    <c:if test="${empty member.mobile || member.mobile == ''}">
                        <li><span class="title f20 ml5 mr5">绑定手机</span></li>
                    </c:if>
                </ul>
                <div class="layui-tab-content">
                    <%--<div class="layui-tab-item"></div>--%>
                    <%--资料编辑--%>
                    <div class="layui-tab-item layui-show">
                        <!-- 正文请写在这里 -->
                        <div class="add-form-content">
                            <form id="myForm" class="layui-form mt20" method="post"
                                  action="${ctx}/system/member/savePartner.do">
                                <div class="layui-form-item" ${member.username != '' && not empty member.username ? '' : 'style="display:none"'}>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">用户名</label>
                                        <div class="layui-input-inline">
                                            <div style="height: 38px; line-height: 38px;">${member.username}</div>
                                            <input type="hidden" name="id" value="${member.id}"/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">昵称<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" name="realname" lay-verify="realname"
                                                   placeholder="昵称" value='${member.realname}' readonly/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">真实姓名<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" name="fullname" lay-verify="fullname"
                                                   placeholder="真实姓名" value='${member.fullname}'/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">头像<span class="f-verify-red">*</span></label>
                                    <div class="cover-content">
                                        <input type="hidden" name="logo" id="pic" lay-verify="pic"
                                               value="${member.logo}"/>
                                        <c:if test="${member == null || empty member.logo}">
                                            <span id="cover-img" class="round-img"
                                                  style="background-image:url(${ctx}/image/def_user_logo.png)"></span>
                                        </c:if>
                                        <c:if test="${member != null && not empty member.logo}">
                                            <span id="cover-img" class="round-img"
                                                  style="background-image:url('${member.logo}')"></span>
                                        </c:if>
                                        <a class="layui-btn layui-btn-danger" id="sel_pic_img">+添加头像</a>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">性别<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="sex" value="1" title="男"
                                            ${member.id == null || member.sex == null || member.sex == '1' ? 'checked="checked"' : ''}
                                            >
                                            <input type="radio" name="sex" value="0" title="女"
                                            ${member.id != null && member.sex == '0' ? 'checked="checked"' : ''}
                                            >
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item" ${member.mobile != '' && not empty member.mobile ? '' : 'style="display:none"'}>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">手机号</label>
                                        <div class="layui-input-inline">
                                            <div style="height: 38px; line-height: 38px;">${member.mobile}</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">QQ号</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="qq" class="layui-input" value="${member.qq}"
                                                   lay-verify="qq">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">微信号</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="wechatNum" class="layui-input"
                                                   value="${member.wechatNum}">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">公司</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="company" class="layui-input"
                                                   value="${member.company}">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">职位</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="jobTitle" class="layui-input"
                                                   value="${member.jobTitle}">
                                        </div>
                                    </div>
                                </div>
<%--                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">行业</label>
                                        <div class="layui-input-inline">
                                            <select lay-verify="industryParent" lay-filter="industryParent">
                                                <option value="">选择行业分类</option>
                                                <c:forEach var="industry" items="${industries}">
                                                    <option value="${industry.id}" ${inParent == industry.id?'selected="selected"' : ''}>${industry.name}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                        <div class="layui-input-inline">
                                            <select name="industry" lay-verify="industry" id="industry">
                                                <option value="">选择行业</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">城市</label>
                                        <div class="layui-input-inline">
                                            <select lay-verify="province" lay-filter="province">
                                                <option value="">选择省份/直辖市</option>
                                                <c:forEach var="area" items="${areas}">
                                                    <option value="${area.id}" ${arParent == area.id?'selected="selected"' : ''}>${area.name}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                        <div class="layui-input-inline">
                                            <select name="city" lay-verify="city" id="city">
                                                <option value="">选择城市</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">资源对接</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="wantRes" lay-verify="wantRes" class="layui-input"
                                                   value="${member.wantRes}">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">是否公开名片</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="isOpen" value="1"
                                                   title="是" ${member != null && member.isOpen == '1' ? 'checked="checked"' : ''}>
                                            <input type="radio" name="isOpen" value="0"
                                                   title="否" ${member == null || member.isOpen == '0' ? 'checked="checked"' : ''}>
                                        </div>
                                    </div>
                                </div>--%>
                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <a href="javascript:void(0)" class="layui-btn layui-btn-danger" lay-submit
                                           lay-filter="infoForm">立即提交</a>
                                        <button type="reset" class="layui-btn layui-btn-primary"
                                                onclick="cancelFunction()">取消
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <c:if test="${partnerType == 4}">
                    <%--提现账号--%>
                    <div class="layui-tab-item">
                        <div class="add-form-content">
                            <form id="bankInfoForm" class="layui-form mt20" method="post"
                                  action="${ctx}/system/member/savePartnerAccount.do">
                                <input type="hidden" name="id" value="${account.id}"/>
                                <input type="hidden" name="memberId"
                                       value="${empty account.memberId?member.id:account.memberId}"/>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label" style="width: 120px!important;">公司名称<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline" style="width:220px;">
                                            <input type="text" class="layui-input" name="name" lay-verify="name"
                                                   placeholder="请准确填写银行卡开卡公司名称" value='${account.name}'/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label" style="width: 120px!important;">联系人手机/电话<span
                                                class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="phone" lay-verify="phone"
                                                   placeholder="请填写联系人手机/电话" value='${account.phone}'/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label" style="width: 120px!important;">公司账号<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="accountNumber"
                                                   lay-verify="accountNumber" placeholder="请填写公司账号"
                                                   value='${account.accountNumber}'/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label" style="width: 120px!important;">银行名称<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="bankName" lay-verify="bankName"
                                                   placeholder="请填写开户银行名称" value='${account.bankName}'/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label" style="width: 120px!important;">开户支行<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline" style="width: 520px;">
                                            <input type="text" class="layui-input" name="openedPlace"
                                                   lay-verify="openedPlace"
                                                   placeholder="请对照银行对账单填写完整支行信息，如：江苏银行杭州西溪小微企业专营支行"
                                                   value='${account.openedPlace}'/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label"></label>
                                        <div class="layui-input-inline">
                                            <button class="layui-btn layui-btn-danger" lay-submit
                                                    lay-filter="bankInfoForm">
                                                提交
                                            </button>
                                            <button type="reset" class="layui-btn layui-btn-primary"
                                                    onclick="cancelFunction()">取消
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    </c:if>
                    <%--修改登录密码--%>
                    <div class="layui-tab-item">
                        <div class="add-form-content">
                            <form id="pwdForm" class="layui-form mt20" method="post"
                                  action="${ctx}/system/member/updatePwd.do">
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width: 240px">
                                            <span style="color: #aaa">密码只能输入6-20位字母或数字</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">原密码<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline">
                                            <input type="password" class="layui-input" name="oldPassword"
                                                   lay-verify="oldPassword" placeholder="原密码"/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">新密码<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline">
                                            <input type="password" class="layui-input" name="password"
                                                   lay-verify="password" placeholder="新密码"/>
                                            <input type="hidden" name="id" value="${member.id}"/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">确认密码<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-inline">
                                            <input type="password" class="layui-input" name="repassword"
                                                   lay-verify="repassword" placeholder="再次确认密码"/>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <a href="javascript:void(0)" class="layui-btn layui-btn-danger" lay-submit
                                           lay-filter="pwdForm">立即修改</a>
                                        <button type="reset" class="layui-btn layui-btn-primary"
                                                onclick="cancelFunction()">取消
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>

                    <%--修改退款密码--%>
                    <div class="layui-tab-item">
                        <form id="refundPwd" class="layui-form mt20" method="post"
                              action="${ctx}/system/member/updateRefundPwd.do">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"></label>
                                    <div class="layui-input-inline" style="width: 240px">
                                        <span style="color: #aaa">密码只能输入6-20位字母或数字</span>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">原退款密码<span class="f-verify-red">*</span></label>
                                    <div class="layui-input-inline">
                                        <input type="password" class="layui-input" name="oldPassword"
                                               lay-verify="oldRefundPassword" placeholder="原退款密码"/>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">新退款密码<span class="f-verify-red">*</span></label>
                                    <div class="layui-input-inline">
                                        <input type="password" class="layui-input" name="newPassword"
                                               lay-verify="newRefundPassword" placeholder="新退款密码"/>
                                        <input type="hidden" name="id" value="${member.id}"/>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">确认退款密码<span class="f-verify-red">*</span></label>
                                    <div class="layui-input-inline">
                                        <input type="password" class="layui-input" name="confirmPassword"
                                               lay-verify="confirmRefundPassword" placeholder="确认新退款密码"/>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"></label>
                                    <div class="layui-input-inline" style="width: 300px">
                                        <button class="layui-btn layui-btn-danger" lay-submit lay-filter="refundPwd">
                                            立即修改
                                        </button>
                                        <button type="reset" class="layui-btn layui-btn-primary"
                                                onclick="cancelFunction()">取消
                                        </button>
                                        <a id="forget_pwd_btn" class="forget-pwd-btn"
                                           href="javascript:void(0)">忘记密码?</a>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <c:if test="${empty member.mobile || member.mobile == ''}">
                        <div class="layui-tab-item">
                            <div class="add-form-content">
                                <form id="bdPhoneForm" class="layui-form mt20" method="post"
                                      action="${ctx}/system/member/bindPhone.do">
                                    <input type="hidden" name="id" value="${member.id}"/>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">手机号<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-block login-input" style="width: 300px;">
                                            <input type="text" name="phone" id="phone1" lay-verify="mobile" autocomplete="off" maxlength="11"
                                                   placeholder="请输入手机号码" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">图片验证码<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-block login-input" style="width: 300px;">
                                            <input type="text" id="imgCode1" lay-verify="imgCode" autocomplete="off"
                                                   placeholder="请输入右侧图片内容" class="layui-input l"
                                                   style="width: calc(100% - 120px); margin-right: 10px;">
                                            <img width="100" src="" alt="" id="code_img1"
                                                 style="height: 36px; width: 108px;">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">手机验证码<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-block login-input" style="width: 300px;">
                                            <input type="text" name="verifyCode" id="verify_code1"
                                                   lay-verify="verifyCode" placeholder="请输入手机验证码" class="layui-input l"
                                                   style="width: calc(100% - 120px); margin-right: 10px;">
                                            <button id="code1" type="button" class="layui-btn layui-btn-primary"
                                                    style="width: 110px!important">发送验证码
                                            </button>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <button class="layui-btn layui-btn-danger" lay-submit
                                                    lay-filter="bdPhoneForm">绑定
                                            </button>
                                            <button type="reset" class="layui-btn layui-btn-primary"
                                                    onclick="cancelFunction()">取消
                                            </button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </c:if>
                </div>
            </div><!--底部-->
        </div>
        <%@include file="../../include/footer.jsp" %>
    </section>
</div>
<!-- 找回密码 -->
<div class="f-def-dialog" id="forget_pwd_dialog">
	<div class="f-dialog-shadow"></div>
	<div class="f-dialog-content" style="height: auto;">
		<span class="close-icon"><i class="iconfont icon-close"></i></span>
		<div class="dialog-header">
			<span class="title">重置退款密码</span>
		</div>
		<div class="dialog-detail" style="width: 370px">
			<!-- 找回密码 -->
			<form id="findpwd_form" class="layui-form" method="post">
				<div class="layui-form-item">
					<div class="layui-input-block login-input">
						<input type="text" name="mobile" lay-verify="refundMobile" id="phone" autocomplete="off"
							   readonly value="${member.mobile}"
							   placeholder="请输入手机号码" class="layui-input l">
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block login-input">
						<input type="text" id="imgCode" lay-verify="imgCode" autocomplete="off" placeholder="请输入右侧图片内容"
							   class="layui-input l" style="width: calc(100% - 120px);">
						<img width="100" src="" alt="" id="code_img" style="height: 36px; width: 110px;">
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block login-input">
						<input type="text" name="verifyCode" id="verify_code" lay-verify="verifyCode" autocomplete="off"
							   placeholder="请输入手机验证码" class="layui-input l" style="width: calc(100% - 120px);">
						<button id="code" type="button" class="layui-btn layui-btn-primary"
								style="width: 110px!important">发送验证码
						</button>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block login-input">
						<input type="password" class="layui-input" name="password" lay-verify="newRefundPassword"
							   placeholder="请输入新退款密码"/>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block login-input">
						<input type="password" class="layui-input" name="confirmPassword" lay-verify="confirmRefundPassword"
							   placeholder="请再次输入退款密码"/>
					</div>
				</div>
				<button type="button" class="layui-btn layui-btn-danger login-btn" lay-submit lay-filter="findpwd-form">
					重置密码
				</button>
				<button type="button" class="layui-btn layui-btn-primary login-btn" id="cancel_btn">取消</button>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript" src="${ctx}/script/common/v_code.js"></script>
<script>
	$(function() {
        layui.use([ 'form', 'laydate', 'element' ], function() {
            var form = layui.form, laydate = layui.laydate, element = layui.element;

            element.on('tab', function(data) {

            });

            //自定义验证规则
            form.verify({
                fullname : function(value) {
                    if (value == "") {
                        return '请输入真实姓名';
                    }
                },
                realname : function(value) {
                    if (value == "") {
                        return '请输入昵称';
                    }
                },
                pic : function(value) {
                    if (value == "") {
                        return "请上传头像";
                    }
                },
                mobile : function(value) {
                    if (value == "") {
                        return "请输入手机号码";
                    } else if (!util.checkMobile(value)) {
                        return "请输入正确格式的手机号码";
                    } else if (value != "" && util.checkMobile(value)) {
                        var isRepeat = txz.checkGroupIsUnique('mobile', value, '${member.id}', 2);
                        if (undefined == isRepeat) {
                            return "验证手机号异常";
                        } else if (isRepeat) {
                            return "手机号已存在";
                        }
                    }
                },
                oldPassword : function(value) {
                    if (value == "") {
                        return "原密码不能为空";
                    } else {
                        var isRepeat = ajaxSubmit({
                            password : value,
                            userId : '${member.id}'
                        },"${ctx}/system/member/checkPassword.do");
                        if (isRepeat) {
                            return "原密码错误";
                        }
                    }
                },
                password : function(value) {
                    if (value == "") {
                        return "密码不能为空";
                    } else if (!util.checkPassword(value)) {
                        return "密码格式不正确";
                    }
                },
                repassword : function(value) {
                    var pwd = $("#pwdForm [name=password]").val();
                    if (value == "") {
                        return "确认密码不能为空";
                    } else if (!util.checkPassword(value)) {
                        return "确认密码格式不正确";
                    } else if(pwd != value){
                        return "确认密码与新密码不匹配";
                    }
                },
                verifyCode : function(value) {
                    if(value == ""){
                        return "请输入手机验证码";
                    }
                },
                qq : function (value) {
                    if (value != "" && !util.checkQQ(value)) {
                        return "QQ号格式不正确";
                    }
                },
                imgCode : function (value) {
                    if (value == "") {
                        return "请输入右侧图片内容";
                    }
                },
				oldRefundPassword: function (value) {
                    if (value == "") {
                        return "原退款密码不能为空";
                    } else if (!util.checkPassword(value)) {
                        return "原退款密码格式不正确";
                    }
                },
                newRefundPassword: function (value) {
                    if (value == "") {
                        return "新退款密码不能为空";
                    } else if (!util.checkPassword(value)) {
                        return "新退款密码格式不正确";
                    }
                },
                confirmRefundPassword: function (value) {
                    var pwd = $("#findpwd_form [name=password]").val();
                    if (!pwd) {
                        pwd = $("#refundPwd [name=confirmPassword]").val();
                    }
                    if (value == "") {
                        return "确认密码不能为空";
                    } else if (!util.checkPassword(value)) {
                        return "确认密码格式不正确";
                    } else if (pwd != value) {
                        return "确认密码与新密码不匹配";
                    }
                },

                /*提现账号*/
                name: function (value) {  //提现账号的公司名称
                    if (!util.isValid(value)) {
                        return "请填写公司名称";
                    }
                },
                phone: function (value) { //提现账号的联系人手机号码
                    if (!util.isValid(value)) {
                        return "请填写联系人手机/电话";
                    }

                    var mb = /^(?:(?:0\d{2,3})-)?(?:\d{7,8})(-(?:\d{3,}))?$/;
                    if (!util.checkMobile(value) && !mb.test(value)) {
                        return "联系人手机/电话格式不正确";
                    }
                },
                accountNumber: function (value) { //提现账号的银行账号
                    if (!util.isValid(value))
                        return "请填写公司的银行账号";
                    if (value.trim().length < 13)
                        return "银行账号格式不正确";
                },
                bankName: function (value) { //提现账号的开户银行名称
                    if (!util.isValid(value))
                        return "请填写开户的银行名称";
                    if (value.trim().length < 4)
                        return "银行名称不符合规则";
                },
                openedPlace: function (value) { //提现账号的银行支行名称
                    if (!util.isValid(value))
                        return "请填写开户的银行支行名称";
                    if (value.trim().length < 6)
                        return "银行支行名称不符合规则";
                },
            });

            function ajaxSubmit(data, url) {
                var isRepeat = false;
                $.ajax({
                    type : 'POST',
                    async : false, // 使用同步的方法
                    data : data,
                    dataType : 'json',
                    success : function(result) {
                        isRepeat = !result;
                    },
                    url : url
                });
                return isRepeat;
            }

            //监听提交 编辑资料
            form.on('submit(infoForm)', function (data) {
                txz.submitObject(data.elem, function (callBack) {
                    var action = $("#myForm").attr("action");
                    $.post(action, $('#myForm').serialize(), function (res) {
                        typeof callBack === 'function' && callBack();
                        if (res.success) {
                            util.layerMsgSuccess("资料编辑成功", function () {
                                window.location.reload();
                            })
                        } else {
                            util.layerMsgError("资料编辑失败")
                        }
                    })
                });
                return false;
            });
            //监听提交 修改密码
            form.on('submit(pwdForm)', function (data) {
                txz.submitObject(data.elem, function (callBack) {
                    var action = $("#pwdForm").attr("action");
                    $.post(action, $('#pwdForm').serialize(), function (res) {
                        typeof callBack === 'function' && callBack();
                        if (res.success) {
                            util.layerMsgSuccess("密码修改成功", function () {
                                window.location.reload();
                            })
                        } else {
                            util.layerMsgError("密码修改失败")
                        }
                    })
                });
                return false;
            });

            //监听提交 修改退款密码
            form.on('submit(refundPwd)', function (data) {
                txz.submitObject(data.elem, function (callBack) {
                    var action = $("#refundPwd").attr("action");
                    $.post(action, $('#refundPwd').serialize(), function (res) {
                        typeof callBack === 'function' && callBack();
                        if (res.success) {
                            util.layerMsgSuccess("退款密码修改成功", function () {
                                window.location.reload();
                            })
                        } else {
                            util.layerMsgError(res.description)
                        }
                    })
                });
                return false;
            });

            //监听提交 修改密码
            form.on('submit(mchForm)', function (data) {
                txz.submitObject(data.elem, function (callBack) {
                    var action = $("#mchForm").attr("action");
                    $.post(action, $('#mchForm').serialize(), function (res) {
                        typeof callBack === 'function' && callBack();
                        if (res.success) {
                            util.layerMsgSuccess("商户信息保存成功", function () {
                                window.location.reload();
                            })
                        } else {
                            util.layerMsgError("商户信息保存失败")
                        }
                    })
                });
                return false;
            });

            //监听提交 绑定手机
            form.on('submit(bdPhoneForm)', function(data) {
                var newData = data;
                Vcode.checkCode(cb(newData));

                function cb(data) {
                    txz.submitObject(data.elem, function (callBack) {
                        var action = $("#bdPhoneForm").attr("action");
                        $.post(action, $('#bdPhoneForm').serialize(), function (res) {
                            typeof callBack === 'function' && callBack();
                            if (res.success) {
                                util.layerMsgSuccess("手机绑定成功", function () {
                                    window.location.reload();
                                })
                            } else {
                                util.layerMsgError("手机绑定失败")
                            }
                        });
                    })
                }

                return false;
            });


            // 提交提现账号信息
            form.on('submit(bankInfoForm)', function (data) {
                var id = $('#bankInfoForm [name=id]').val();
                txz.submitObject(data.elem, function (callBack) {
                    var action = $("#bankInfoForm").attr("action");
                    $.post(action, $('#bankInfoForm').serialize(), function (res) {
                        typeof callBack === 'function' && callBack();
                        if (res.success) {
                            util.layerMsgSuccess('提现账号' + (id == '' ? '保存' : '修改') + '成功', function () {
                                window.location.reload();
                            });
                        } else {
                            util.layerMsgError("提现账号" + (id == '' ? '保存' : '修改') + "失败")
                        }
                    });
                })
                return false;
            });

            // 城市
/*            form.on('select(province)', function(data) {
                $("#city").html("");
                var cityId = data.value;
                loadCityData(cityId);
            });*/

            // 行业
/*            form.on('select(industryParent)', function(data) {
                $("#industry").html("");
                var industryId = data.value;
                loadIndustryData(industryId);
            });*/

/*            if ('${member.city}' != "") {
                loadCityData('${arParent}');
            }*/

/*            if ('${member.industry}' != "") {
                loadIndustryData('${inParent}');
            }*/

            function loadCityData(cityId) {
                $.post("${ctx}/system/member/getCityByParentId.do", {
                    "cityId" : cityId
                }, function(data) {
                    var array = new Array();
                    for (var i = 0; i < data.length; i++) {
                        if ('${member.city}' == data[i].id) {
                            array.push("<option value = '"+data[i].id+"' selected='selected'>" + data[i].name + "</option>");
                        } else {
                            array.push("<option value = '"+data[i].id+"'>" + data[i].name + "</option>");
                        }
                    }
                    $("#city").append(array.join(""));
                    form.render('select');
                });
            }

            function loadIndustryData(industryId) {
                $.post("${ctx}/system/member/getIndustryByParentId.do", {
                    "industryId" : industryId
                }, function(data) {
                    var array = new Array();
                    for (var i = 0; i < data.length; i++) {
                        if ('${member.industry}' == data[i].id) {
                            array.push("<option value = '"+data[i].id+"' selected='selected' >" + data[i].name + "</option>");
                        } else {
                            array.push("<option value = '"+data[i].id+"'>" + data[i].name + "</option>");
                        }
                    }
                    $("#industry").append(array.join(""));
                    form.render('select');
                });
            }

            form.on('submit(findpwd-form)', function (data){
                var dt = data;
                Vcode.checkCode(cb(dt));
                function cb (data) {

                    txz.ajaxRequest({
                        url: '${ctx}/user/resetRefundPassword.do',
                        type: 'POST',
                        async: false, // 使用同步的方法
                        params: $('#findpwd_form').serialize(),
                        callBack: function (res) {
                            if (res.success) {
                                util.layerMsgSuccess("密码重置成功", function () {
                                    window.location.reload();
                                })
                            } else {

                                util.layerMsgError(res.description)
                            }
                        }
                    })
                }
			});
        });
        $('#sel_pic_img').click(function () {
            txz.openSelImg({
                min: 1,
                max: 1,
                info: '建议尺寸：120x120',
                type: '<%=TargetType.LOGO.getCode()%>',
                cb: function (imgs) {
                    $('#cover-img').css('background-image', 'url(' + imgs[0].path + ')');
                    $('#pic').val(imgs[0].path);
                }
            })
        });

        $("#phone1").bind("input propertychang",function(event){
            var viewName = this.value;
            if (viewName && viewName.length == 11) {
                $('#code_img1').attr('src', '${ctx}/verification/mobile/crimg/' + viewName + '.do');
                $('#code_img1').css("border", "1px solid #e6e6e6");

                Vcode.params.vCodeImg = '#code_img1';
                Vcode.params.vImgCode = '#imgCode1';
                Vcode.params.vGetCodeBtn = '#code1';
                Vcode.params.vPhone = '#phone1';
                Vcode.params.vCode = '#verify_code1';
                Vcode.params.vMemberType = 2;

                Vcode.addEvent();
            }
        });

        $('#cancel_btn,.f-def-dialog .close-icon').click(function () {
            $('#forget_pwd_dialog').fadeOut();
            Vcode.unBind();
        });

        $('#forget_pwd_btn').click(function () {
			var mobile = $('#mobile').val();
			if (!mobile) {
                util.layerAlertError("请先绑定手机")
			    return;
            }
            $("[name=loginName]").val(mobile);

            $('#forget_pwd_dialog').fadeIn();

            $('#code_img').attr('src', '${ctx}/verification/mobile/crimg/' + mobile + '.do');
            $('#code_img').css("border", "1px solid #e6e6e6");
            $('#img_code_li').show();

            Vcode.params.vCodeImg = '#code_img';
            Vcode.params.vImgCode = '#imgCode';
            Vcode.params.vGetCodeBtn = '#code';
            Vcode.params.vPhone = '#phone';
            Vcode.params.vCode = '#verify_code';
            Vcode.params.vMemberType = 2;

            Vcode.addEvent();
        });

    });

    function cancelFunction() {
        location.href = "${ctx}/merchant/analyze/detail.do";
    }
</script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '账户中心'
        }, {
            name: '资料编辑',
            curr: true
        }],
        btns: [{
            name: '返回',
            icon: 'back',
            href: '${ctx}/system/member/memberIndex.do'
        }]
    });
</script>
</body>
</html>